package com.sinosoft.sinopay.service.merchant.entity.facade;

/**
 * Created by chenzhiheng on 16/11/29.
 */

import com.sinosoft.sinocloud.platform.base.SinoBaseService;
import com.sinosoft.sinocloud.platform.common.exception.biz.IllegalRequestException;
import com.sinosoft.sinocloud.platform.common.web.pagequery.PageGrid;
import com.sinosoft.sinocloud.platform.common.web.pagequery.PageQueryModel;
import com.sinosoft.sinopay.merchants.dto.MerchantDTO;
import com.sinosoft.sinopay.merchants.dto.PayMerchantDTO;
import com.sinosoft.sinopay.merchants.facade.MerchantInfoFacadeService;
import com.sinosoft.sinopay.service.merchant.biz.service.MerchantInfoCoreService;
import com.sinosoft.sinopay.merchants.dto.MerchantSignInfo;
import com.sinosoft.sinopay.service.merchant.generated.model.PayMerchant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 【商户安全认证微服务接口类】
 * @author chenzhiheng
 * @version V1.0
 * @date 2016/11/29 下午2:57
 */
@Service
public class MerchantInfoFacadeServiceImpl extends SinoBaseService implements MerchantInfoFacadeService {

    @Autowired
    private MerchantInfoCoreService merchantInfoCoreService;

    /**
     * 获取全部的商户签名信息
     * @return   key为商户code，value为商户signkey
     */
    @Override
    public  Map<String,String>  getAllMerchantSignKeys() throws IllegalRequestException {
        return merchantInfoCoreService.getAllMerchantSignKeys();
    }

    /**
     * 根据页码和参数获取当页商户信息集合
     * @return
     */
    @Override
    public PageGrid getMerchantMsgForPageAndDate(PageQueryModel pageQueryModel){
        return merchantInfoCoreService.getMerchantMsgForPageAndDate(pageQueryModel);
    }

    /**
     * 根据sid查询商户详情信息
     * @return  商户详情信息
     */
    @Override
    public MerchantSignInfo getMerchantForSid(Integer sid){
        return merchantInfoCoreService.getMerchantForSid(sid);
    }

    /**
     * 新增商户信息
     * @return  商户信息Sid
     */
    @Override
    public String addMerchantMsg(PayMerchantDTO payMerchant){
        return merchantInfoCoreService.addMerchantMsg(payMerchant);
    }


    /**
     * 更新商户信息
     * @return  true = 更新成功; false = 更新失败
     */
    @Override
    public String updateMerchantMsg(PayMerchantDTO payMerchant){
        return merchantInfoCoreService.updateMerchantMsg(payMerchant);
    }

    /**
     * 删除商户信息
     * @return  删除成功; false = 删除失败
     */
    @Override
    public boolean deleteMerchantMsg(Integer sid){
        return merchantInfoCoreService.deleteMerchantMsg(sid);
    }


    /**
     *查询所有商户名和商户编码
     *@return  商户名和商户编码
     */
    @Override
    public List<MerchantDTO> selectMerchantName(){ return merchantInfoCoreService.selectMerchantName(); }

    /**
     *根据商户CODE查询商户信息
     *@return 商户详情信息
     */
    public MerchantSignInfo getMerchantByCode(String merchantCode){ return merchantInfoCoreService.selectMerchantByCode(merchantCode); }
}
